package router

import (
	v1 "gitee.com/wochong/HalloGin/router/api/v1"
	"github.com/gin-gonic/gin"
	"log"
)

// InitRouter initialize routing information
func SetupRouter() *gin.Engine {

	gin.SetMode(gin.ReleaseMode)

	r := gin.Default()

	log.SetFlags(log.LstdFlags) // gin will disable log flags

	//r.StaticFS("/export", http.Dir(export.GetExcelFullPath()))
	//r.StaticFS("/upload/images", http.Dir(upload.GetImageFullPath()))
	//r.StaticFS("/qrcode", http.Dir(qrcode.GetQrCodeFullPath()))

	//r.GET("/auth", api.GetAuth)
	//r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
	//r.POST("/upload", api.UploadImage)

	apiV1 := r.Group("/api/v1")
	//apiV1.Use(jwt.JWT())
	{
		////获取标签列表
		apiV1.GET("/user", v1.GetUser)
		apiV1.GET("/users", v1.GetAllUser)
		////新建标签
		apiV1.POST("/user", v1.AddUser)
		////更新指定标签
		apiV1.PUT("/user", v1.UpdateUser)
		apiV1.PUT("/userV2", v1.UpdateUserV2)
		////删除指定标签
		//apiV1.DELETE("/tags/:id", v1.DeleteTag)
		////导出标签
		//r.POST("/tags/export", v1.ExportTag)
		////导入标签
		//r.POST("/tags/import", v1.ImportTag)
		//
		////获取文章列表
		//apiV1.GET("/articles", v1.GetArticles)
		////获取指定文章
		//apiV1.GET("/articles/:id", v1.GetArticle)
		////新建文章
		//apiV1.POST("/articles", v1.AddArticle)
		////更新指定文章
		//apiV1.PUT("/articles/:id", v1.EditArticle)
		////删除指定文章
		//apiV1.DELETE("/articles/:id", v1.DeleteArticle)
		////生成文章海报
		//apiV1.POST("/articles/poster/generate", v1.GenerateArticlePoster)
	}

	return r
}
